import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Test {
    public static void main(String[] args) {
        Collection<String> c=new ArrayList<>();
        c.add("java1");
        c.add("java3");
        c.add("java3");
        c.add("java1");
        c.add("java2");
        c.add("java2");
      /*  Iterator<String> it=c.iterator();
        System.out.println(it.next());
        System.out.println(it.next());
        System.out.println(it.next());
        System.out.println(it.next());*/
      /* Iterator<String> it =c.iterator();
       while(it.hasNext()){
           System.out.println(it.next());
       }*/
        for (String ele:c) {
            System.out.println(ele);

        }
    }
}
